package edu.zzu.daoImpl;

import edu.zzu.Entity.PackageRoute;
import edu.zzu.dao.PackageRouteDao;
import edu.zzu.dao.RegionDao;
import edu.zzu.mapper.PackageRouteMapper;
import edu.zzu.mapper.TransNodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class PackageRouteDaoImpl implements PackageRouteDao {

    @Autowired
    private PackageRouteMapper packageRouteMapper;

    @Autowired
    private TransNodeMapper transNodeMapper;

    @Autowired
    private RegionDao regionDao;

    @Override
    public List<PackageRoute> getPackageRouteById(String id) {
        return packageRouteMapper.selectPackageRouteByPackageId(id);
    }

    @Override
    public String selectAddressByTransNodeId(Long id) {
        return regionDao.getRegionNameById(transNodeMapper.selectRegionCodeById(id))+transNodeMapper.selectNameById(id);
    }
}
